import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';


export default {
  input: 'src/utils/FormStorage.js', // 输入文件路径
  // 打包输出的不同格式
  output: [
    {
      file: 'dist/FormStorage.cjs.js', // CommonJS 产物路径
      format: 'cjs',
      sourcemap: true,
    },
    {
      file: 'dist/FormStorage.esm.js', // ES 模块产物路径
      format: 'esm',
      sourcemap: true,
    },
    {
      file: 'dist/FormStorage.umd.js', // UMD 产物路径
      format: 'umd',
      name: 'FormStorage',
      sourcemap: true,
    },
  ],
  plugins: [
    resolve(), // 使 Rollup 能够找到 node_modules 中的模块
    commonjs(), // 使 Rollup 能够转换 CommonJS 模块为 ES6
    terser(), // 压缩代码
  ],
};